<template>
  <div class="coupons" :style="{ '--btn_color': btn_color }">
    <div class="title">
      <span></span>
      <div>我的奖品</div>
      <span></span>
      <div class="triangle_left_border"></div>
      <div class="triangle_right_border"></div>
    </div>

    <div class="gift_pop">
      <vm-scrollbar tag="div" :wrapStyle="{ height: height + 'px' }">
        <div
          class="conter"
          v-for="(item, i) in prizeLists"
          :key="item.order_id"
          v-if="prizeLists"
        >
          <div class="text3">
            <div class="avatarandname">
              <span style="font-size: 2rem; margin-right: 5px">
                {{ i + 1 }}
              </span>
              <div class="imgs">
                <img :src="item.picture" alt="" />
              </div>
              <!-- <img round width="2.3rem" height="2.3rem" :src="item.picture" /> -->
              <span class="name">{{ item.name }}</span>
            </div>
            <div class="prize_type" v-if="item.name != '谢谢参与'">
              <span class="times">{{ item.prize_type_name }}</span>
              <span
                class="times"
                style="padding-left: 10px"
                v-if="item.prize_type_name != '自提'"
                >({{ item.orderdelivery_status }})</span
              >
              <van-button
                :style="{ backgroundColor: bnt_color }"
                class="button"
                size="mini"
                @click="verificationClick(item)"
                >核销</van-button
              >
            </div>
          </div>
        </div>
        <nodata-piz v-show="!prizeLists.length"></nodata-piz>
      </vm-scrollbar>
    </div>
  </div>
</template>

<script>
import { Icon, Image as VanImage, Button } from "vant";
import NodataPiz from "./NodataPiz.vue";
export default {
  components: {
    [Icon.name]: Icon,
    [VanImage.name]: VanImage,
    [Button.name]: Button,
    NodataPiz,
  },
  props: {
    activityItem: {
      type: Object,
      required: true,
    },
    openid: {
      type: String,
      required: true,
    },
    prizeLists: {
      type: Array,
      required: true,
    },
    
  },
  data() {
    return {
      btn_color: "",
      introduce: [],
      activity_id: null,
      height: null,
    };
  },
  created() {
    this.btn_color = this.activityItem.btn_color;
    this.introduce = this.activityItem.introduce;
    this.activity_id = this.activityItem.id;
    // this.getPrizeList();
    console.log(this.activityItem, "activityItem");
  },
  mounted() {
    this.height = document.documentElement.clientHeight * 0.37;
    // console.log(this.activityItem, 'activityItem');
  },
  methods: {
    // getPrizeList() {
    //   let params = { activity_id: this.activity_id, openid: this.openid };
    //   this.$request.prizeList(params).then((res) => {
    //     this.prizeLists = res.data.data;
    //     // console.log(this.prizeLists, "this.prizeLists");
    //   });
    // },
    // 奖品核销
    verificationClick(item) {
      console.log(item);
      this.$store.commit("setOrderItem", item);
      this.$router.push("/caseShow/lottoActivity/ApplyPZ");
    },
  },
};
</script>

<style lang="scss" scoped>
.coupons {
  margin: 3.5rem 0 1rem 0;
  // width: 90%;
  background-color: #fff;
  border-radius: 8px;
  padding: 1.5rem 1rem 1rem;
  box-sizing: border-box;
  position: relative;
  .title {
    width: 12rem;
    height: 3rem;
    background: var(--btn_color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    line-height: 3rem;
    text-align: center;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    letter-spacing: 0.3rem;
    font-size: 1.4rem;
    span {
      display: inline-block;
      width: 1rem;
      height: 1rem;
      border-radius: 1rem;
      background-color: #ffdb89;
    }
    span:nth-child(1) {
      margin-right: 0.5rem;
    }
    span:nth-child(2) {
      margin-left: 0.2rem;
    }
    .triangle_left_border {
      width: 0;
      height: 0;
      border-bottom: 1.5rem solid var(--btn_color);
      border-left: 1.5rem solid transparent;
      position: absolute;
      left: 0%;
      top: 0%;
      margin-left: -1.5rem;
    }
    .triangle_right_border {
      width: 0;
      height: 0;
      border-bottom: 1.5rem solid var(--btn_color);
      border-right: 1.5rem solid transparent;
      position: absolute;
      left: 100%;
      top: 0%;
    }
  }

  .gift_pop {
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    // align-items: center;
    height: auto;
    background-color: white;
    position: relative;
    padding: 1rem 0;
    // overflow-y: scroll;
    .conter {
      box-sizing: border-box;
      // width: 80%;
      height: 3rem;
      margin: 1rem 0 0 1rem;
      .text3 {
        display: flex;
        justify-content: space-between;
        align-items: center;
        color: #333333;
        height: 2rem;
        .avatarandname {
          display: flex;
          align-items: center;
          .imgs {
            width: 2.3rem;
            height: 2.3rem;
            overflow: hidden;
            img {
              display: inline-block;
              border-radius: 50%;
              width: 100%;
              height: 100%;
            }
          }
          .name {
            margin-left: 15px;
          }
        }
        .prize_type {
          display: flex;
          align-items: center;
          .button {
            margin-left: 10px;
            background-color: var(--btn_color);
            border: 0;
            color: #fff;
          }
        }
      }
    }
  }
}
</style>